package fragment;

import android.os.Bundle;

import androidx.databinding.DataBindingUtil;
import androidx.databinding.ViewDataBinding;
import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.redrose.audioandvideo.R;


public abstract class BaseFragment <T extends ViewDataBinding>extends Fragment {

    protected T mBind;

    public BaseFragment() {

    }


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        mBind = DataBindingUtil.inflate(LayoutInflater.from(getContext()),getLayoutId(),null,false);
        initView();
        initEvent();
        initData();
        return mBind.getRoot();
    }

    protected abstract void initData();

    protected abstract void initEvent();

    protected abstract void initView();

    protected abstract int getLayoutId();
}
